package com.example.ssm.service.imp;

import com.example.ssm.Bean.Account;
import com.example.ssm.Conn.SqlConn;
import com.example.ssm.Dao.AccountMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Service;


import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * @create 2022-03-2022/3/6-10:30
 */
@Service("accountServices")
public class AccountService implements com.example.ssm.service.AccountService {

    private SqlConn conn =new SqlConn();
    private AccountMapper accountMapper=null;

    public void save(Account account) throws IOException {
        accountMapper=conn.conn();
        accountMapper.saveAccount(account);
        conn.close();

    }

    public List<Account> findAll() throws IOException {
        accountMapper=conn.conn();
        List<Account> list=accountMapper.findAll();
        conn.close();
        return list;
    }
}
